package Java攻略._3_流式操作._3_利用reduce方法实现归约操作;

import java.util.stream.IntStream;

public class _16_打印x和y的值 {

    public static void main(String[] args) {

        int sum = IntStream.rangeClosed(1, 10)
                .reduce((x, y) -> {
                    System.out.printf("x=%d,y=%d%n", x, y);
                    return x + y;
                }).orElse(0);

        System.out.println(sum);
    }
}
